package com.eostoken.eos_wallet.mvp.presenter;

import android.app.Activity;
import android.content.Context;

import com.eostoken.eos_wallet.mvp.callback.CommonCallback;
import com.eostoken.eos_wallet.mvp.mode.ResourceAdministrationModel;
import com.eostoken.eos_wallet.mvp.view.ResourceAdministrationView;
import com.fredy.mvp.BasePresenter;

import java.util.Map;

import static com.eostoken.eos_wallet.utils.Constants.ACCOUNT_INFO;

public class ResourceAdministrationPresenterImpl extends BasePresenter<ResourceAdministrationModel, ResourceAdministrationView> implements ResourceAdministrationPresenter, CommonCallback {
    private Activity context;

    public ResourceAdministrationPresenterImpl(Activity context) {
        super(context);
        this.context = context;
    }

    @Override
    public void onSuccess(Object data, String successMsg, int responseSuccessCode) {
        switch (responseSuccessCode) {
            case ACCOUNT_INFO:
                getView().updateView(data, responseSuccessCode);
                break;
        }
    }

    @Override
    public void onFailure(String msg, int responseFailCode) {
        switch (responseFailCode) {
            case ACCOUNT_INFO:
                getView().onFailure(msg, responseFailCode);
                break;
        }
    }

    @Override
    protected void onViewDestroy() {

    }

    @Override
    public void getData(boolean isRefresh) {

    }

    @Override
    public void getMoreData() {

    }

    @Override
    public void requestAccount(Map<String, Object> params) {
        model.getAccount(context, params, true, this);
    }
}
